home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / lfsstats / lfsstats.c < prev    next >
C/C++ Source or Header  |  1992-04-14  |  2KB  |  97 lines

  1. /* 
  2.  * showStats.c --
  3.  *
  4.  *    Show the stats of an LFS file system
  5.  *
  6.  * Copyright 1989 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/admin/lfsstats/RCS/lfsstats.c,v 1.2 92/04/14 14:12:23 mendel Exp $ SPRITE (Berkeley)";
  18. #endif /* not lint */
  19.  
  20. #include "lfslib.h"
  21. #ifdef _HAS_PROTOTYPES
  22. #include <varargs.h>
  23. #endif
  24. #include <stdio.h>
  25. #include <sys/types.h>
  26. #include <sys/file.h>
  27.  
  28. #include <sprite.h>
  29. #include <unistd.h>
  30. #include <option.h>
  31. #include <stdlib.h>
  32. #include <string.h>
  33.  
  34. int    blockSize = 512;
  35.  
  36. char    *deviceName;
  37.  
  38. Option optionArray[] = {
  39.     {OPT_DOC, (char *) NULL,  (char *) NULL,
  40.     "This program shows the LfsStats structure of an LFS file system.\n Synopsis: \"lfsstats deviceName\""},
  41. };
  42. /*
  43.  * Forward routine declartions. 
  44.  */
  45.  
  46. static void ShowStats _ARGS_((Lfs_Stats *statsPtr));
  47.  
  48. /*
  49.  *----------------------------------------------------------------------
  50.  *
  51.  * main --
  52.  *
  53.  *    Main routine of lfsstats - parse arguments and do the work.
  54.  *
  55.  * Results:
  56.  *    None.
  57.  *
  58.  * Side effects:
  59.  *    None.
  60.  *
  61.  *----------------------------------------------------------------------
  62.  */
  63.  
  64. int
  65. main(argc,argv)
  66.     int    argc;
  67.     char *argv[];
  68. {
  69.     Lfs    *lfsPtr;
  70.  
  71.  
  72.  
  73.     argc = Opt_Parse(argc, argv, optionArray, Opt_Number(optionArray), 0);
  74.     if (argc != 2) { 
  75.          Opt_PrintUsage(argv[0], optionArray, Opt_Number(optionArray));
  76.      exit(1);
  77.     } else {
  78.     deviceName = argv[1];
  79.     }
  80.     lfsPtr = LfsLoadFileSystem(argv[0], deviceName, blockSize, 
  81.             LFS_SUPER_BLOCK_OFFSET,
  82.                 O_RDONLY);
  83.     if (lfsPtr == (Lfs *) NULL) {
  84.     exit(1);
  85.     }
  86.  
  87.     ShowStats(&lfsPtr->stats);
  88.     exit(0);
  89.     return 0;
  90. }
  91. static void
  92. ShowStats(statsPtr)
  93.     Lfs_Stats *statsPtr;
  94. {
  95. #include "statprint.h"
  96. }
  97.